DELETE = rm -rf                   # Command to remove files
B_SOURCES = board.c mongoose.c  packed_fs.c ptylib.c      # Source code files, packed_fs.c contains ca.pem, which contains CA certs for TLS
C_SOURCES = client.c mongoose.c  packed_fs.c ptylib.c
CFLAGS = -W -Wall -Wextra -g -I.  # Build options
CRISS_CC = arm-mix510-linux-gcc
CC = gcc

# Mongoose build options. See https://mongoose.ws/documentation/#build-options
CFLAGS_MONGOOSE += -DMG_ENABLE_LINES=1 -DMG_ENABLE_PACKED_FS=1

all: board client pty

board: $(B_SOURCES)       # Build program from sources
	$(CRISS_CC) $(B_SOURCES) $(CFLAGS) $(CFLAGS_MONGOOSE) $(CFLAGS_EXTRA) -o /tftpboot/board

client: $(C_SOURCES)       # Build program from sources
	$(CC) $(C_SOURCES) $(CFLAGS) $(CFLAGS_MONGOOSE) $(CFLAGS_EXTRA) -o /tftpboot/client

pty:pty.c ptylib.c
	$(CC) pty.c ptylib.c -o pty